﻿using AutoMapper;
using Modules.Device;
using Modules.Device.Entitys;
using PmSoft;

namespace ManagementApi.Models.System.ProjectCheckinDeviceCommandLog
{
    public class ProjectCheckinDeviceCommandDto
    {
        /// <summary>
        /// 主键 
        ///</summary>
        public int Id { get; set; }
        /// <summary>
        /// 命令名称 
        ///</summary>
        public string Name { get; set; }
        /// <summary>
        /// 命令代码 
        ///</summary>
        public string Operator { get; set; }
        /// <summary>
        /// 消息id 
        ///</summary>
        public string MessageId { get; set; }
        /// <summary>
        /// 下发状态  200为成功 
        ///</summary>
        public string Code { get; set; }
        /// <summary>
        /// 设备编码 
        ///</summary>
        public string DeviceCode { get; set; }
        /// <summary>
        /// 返回信息 
        ///</summary>
        public string Result { get; set; }
        /// <summary>
        /// 下发时间 
        ///</summary>
        public DateTime? DistributeTime { get; set; }
        /// <summary>
        /// 返回时间 
        ///</summary>
        public DateTime? ResultTime { get; set; }
        /// <summary>
        /// 是否自动下发
        /// </summary>
        public bool IsAuto { get; set; }
        /// <summary>
        /// 创建时间 
        ///</summary>
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 下发命令
        /// </summary>
        public string Jobs { get; set; }
        /// <summary>
        /// 返回结果
        /// </summary>
        public string ResultMsg { get; set; }
        /// <summary>
        /// 命令下发状态
        /// </summary>
        public 命令下发状态 Status { get; set; }
    }

    public static partial class ProjectCheckinDeviceCommandLogExceptions
    {
        public static ProjectCheckinDeviceCommandDto AsDto(this CheckinDeviceCommand entity)
        {
            var mapper = ServiceAccessor.GetService<IMapper>();
            ProjectCheckinDeviceCommandDto dto = new ProjectCheckinDeviceCommandDto();
            mapper.Map(entity, dto);
            return dto;

        }
    }
}
